#include "app_user.h"
#include "app_dht11.h"
#include "bsp_dht11.h"
#include "app_oled.h"
#include "bsp_oled.h"
#include "app_ds18b20.h"
#include "bsp_ds18b20.h"



void OLED_ShowTitle(void)
{
		OLED_ShowChinese(32, 0, 22, 16, 1);
		OLED_ShowChinese(48, 0, 23, 16, 1);
		OLED_ShowChinese(64, 0, 24, 16, 1);
		OLED_ShowChinese(80, 0, 25, 16, 1);
		OLED_Refresh();
}



void DHT11_Display(void)
{
		char sbuff[50];
    DHT11_READ_DATA();
    sprintf(sbuff,"DHT11:%d%dC,%d%d%%",DHT11_data[2],DHT11_data[3],DHT11_data[0],DHT11_data[1]);
    OLED_ShowString(0,16,(uint8_t *)sbuff,16,1);
    OLED_Refresh();
	
}


void DS18B20_Display(void)
{
	char sbuff[50];
	sprintf(sbuff,"temp:%hd",DS18B20_Get_Temp);
	OLED_ShowString(0,32,(uint8_t *)sbuff,16,1);
  OLED_Refresh();
}
	

void USER_Init(void)
{
	OLED_Init();
	DHT11_Init();
	DS18B20_Init();
	OLED_ShowTitle();
	
}

void USER_Task(void)
{
	DHT11_Display();
	DS18B20_Display();
}


